display dateOf baseline in current view of the module for variable baseline

When exporting to Word from a view in doors I want to capture the baseline applied. If the baseline in the view is not the most recent how would I get a handle on the baseline? For example if I am viewing baseline 1.1 but the most recent is 1.5 I need a handle on 1.1 to use the dateOf function. Additionally this has to be general so I can't simply create Baseline b = baseline(1,1,null) In essence I need a handle on the Module version in order to get the date the baseline was created. For example:

//I know this won't work but this is what I am trying to get
dateOf(version(Module m))

here is what I have tried so far:
//-----Start of code-----

Module m = current
string myVers = version(current)
ModuleVersion myHandle = moduleVersion(m)
Baseline b = baseline(ModuleVersion myHandle)
bool checkM = baselineExists(myHandle)
if (checkM == true) {
print "baseline exists"
}
else {
print "no baseline exists"
}

print dateOf(b)
//-------End of code--------

The problems:

-It says a baseline exists when in that view there is no baseline (verified by using the function getMostRecentBaseline(m)

-It will not print the dateOf(b) if a baseline does exist here is the error:
-R-E- DXL: <Line:13> null Baseline parameter was passed into argument position 1
-I- DXL: execution halted
SystemAdmin - Thu Jan 31 10:32:18 EST 2013

Re: display dateOf baseline in current view of the module for variable baseline
SystemAdmin - Thu Jan 31 11:14:19 EST 2013

Not sure if I understood you correctly.
Do you need something like

Date d
Module m = current
if (baseline (m)) {
   // m is a baseline. Print the date when it was created
   d = dateOf (baselineInfo(m))
} else {
   // m is current version. Print the date when the last baseline was created
   d = dateOf (getMostRecentBaseline(m))
}
print d

Re: display dateOf baseline in current view of the module for variable baseline
llandale - Thu Jan 31 11:20:38 EST 2013

You can cheat and use History. If you open a baseline and look at Module Properties >History tab, you see the 1st History in the module is the one that performed the Baseline.

History hst = null
HistoryType ht = null
for hst in (current Module) do {break} // stop after 1 History
if (null hst) then Louie is Wrong
ht = hst.type
if (ht != baselineModule) then Louie is Wrong
Date datBaseline = hst.date


-Louie

Re: display dateOf baseline in current view of the module for variable baseline
llandale - Thu Jan 31 11:28:17 EST 2013

llandale - Thu Jan 31 11:20:38 EST 2013

You can cheat and use History. If you open a baseline and look at Module Properties >History tab, you see the 1st History in the module is the one that performed the Baseline.

History hst = null
HistoryType ht = null
for hst in (current Module) do {break} // stop after 1 History
if (null hst) then Louie is Wrong
ht = hst.type
if (ht != baselineModule) then Louie is Wrong
Date datBaseline = hst.date


-Louie

Oops. The very first baseline has "createModule" as the 1st History.
  • if (ht != createModule and ht != baselineModule) then Louie is Wrong

Re: display dateOf baseline in current view of the module for variable baseline
SystemAdmin - Thu Jan 31 12:08:43 EST 2013

llandale - Thu Jan 31 11:28:17 EST 2013
Oops. The very first baseline has "createModule" as the 1st History.

  • if (ht != createModule and ht != baselineModule) then Louie is Wrong

Thank you Louie that is an excellent snippet of code to accomplish this. My concern is how to verify if the version and date in the view is in fact an actual baseline or if it is the current version. I was going to use: bool baselineExists(Module m, Baseline b) but what would I use for the Baseline b argument if the current view does not have a baseline? Would an if null statement work?

Re: display dateOf baseline in current view of the module for variable baseline
llandale - Thu Jan 31 14:06:57 EST 2013

SystemAdmin - Thu Jan 31 12:08:43 EST 2013
Thank you Louie that is an excellent snippet of code to accomplish this. My concern is how to verify if the version and date in the view is in fact an actual baseline or if it is the current version. I was going to use: bool baselineExists(Module m, Baseline b) but what would I use for the Baseline b argument if the current view does not have a baseline? Would an if null statement work?

string version(Module)
bool isBaseline(Module)

Re: display dateOf baseline in current view of the module for variable baseline
SystemAdmin - Thu Jan 31 15:30:45 EST 2013

llandale - Thu Jan 31 14:06:57 EST 2013
string version(Module)
bool isBaseline(Module)

yes but that only tells you if there is a baseline in the module, if I am in a current view that is not baselined (for example appears as yellow in DOORS instead of blue for a baseline) how do I know that the view is not baselined?

Re: display dateOf baseline in current view of the module for variable baseline
llandale - Thu Jan 31 16:07:11 EST 2013

SystemAdmin - Thu Jan 31 15:30:45 EST 2013
yes but that only tells you if there is a baseline in the module, if I am in a current view that is not baselined (for example appears as yellow in DOORS instead of blue for a baseline) how do I know that the view is not baselined?

isBaseline(Module) tells you if THIS open module is a baseline. false means it is the current module.

if (isBaseline(module(obj))) //
then display "baseline"
else display "current"

Views are not baselined. If you baseline a module then delete a view; that view is not available to any baseline.


When you talk about yellow/blue, then perhaps you are asking if the OBJECT has been baselined since it was last modified. Here is some code reflecting my best guess on the topic:

 

if    (isDeleted(obj))                  BackColor       = realColor_Black       // Black:       Deleted (saved)
elseif(unsaved(obj) or new(obj))        BackColor       = realColor_Red         // Red:         Changed not yet saved
elseif(saved(obj))                      BackColor       = realColor_Yellow      // Yellow:      modified since Baseline or module create
else   


-Louie

 

Re: display dateOf baseline in current view of the module for variable baseline
SystemAdmin - Fri Feb 01 09:03:29 EST 2013

llandale - Thu Jan 31 16:07:11 EST 2013

isBaseline(Module) tells you if THIS open module is a baseline. false means it is the current module.

if (isBaseline(module(obj))) //
then display "baseline"
else display "current"

Views are not baselined. If you baseline a module then delete a view; that view is not available to any baseline.


When you talk about yellow/blue, then perhaps you are asking if the OBJECT has been baselined since it was last modified. Here is some code reflecting my best guess on the topic:

 

if    (isDeleted(obj))                  BackColor       = realColor_Black       // Black:       Deleted (saved)
elseif(unsaved(obj) or new(obj))        BackColor       = realColor_Red         // Red:         Changed not yet saved
elseif(saved(obj))                      BackColor       = realColor_Yellow      // Yellow:      modified since Baseline or module create
else   


-Louie

 

Louie,

You are right sorry I misunderstood before, thank you for your great help.

Re: display dateOf baseline in current view of the module for variable baseline
MohanRS - Tue Nov 26 09:44:13 EST 2013

//Hope it helps

Module m = current Module

if(baselineIndex(m)=="1000000") //1000000 is default value if it not baselined before, colour indication won't help.
{
//nothing

print "Not Baselined"
}
else{

print "Baselined->"
print fullName(m)

print dateOf (getMostRecentBaseline(m)) "\n"

}
}